/**
 * v-permission
 * 复制某个值至剪贴板
 * 接收参数：string类型/Ref<string>类型/Reactive<string>类型
 */
import store from "@/store";
import type { Directive, DirectiveBinding } from 'vue'
interface ElType extends HTMLElement {
  // copyData: string|number,
  roles: string[]
}

const directive: Directive = {
  mounted(el: ElType, binding: DirectiveBinding) {
    //获取当前用户
    var info = store.getters["user/userInfo"]
    el.roles = binding.value
    if(!el.roles.includes(info.roleName)){
      el.hidden = true
    }
  },
  updated(el: ElType, binding: DirectiveBinding) {
    // el.roles = binding.value
  },
  beforeUnmount(el: ElType) {
    // el.removeEventListener('click', el.__handleClick__)
  }
}

export default directive